﻿#pragma once


#include <QDialog>
#include <QPushButton>
#include "QListView"
#include "QStringListModel"
#include "QFileDialog"
#include "QMessageBox"
#include "QApplication"
#include "QVBoxLayout"
#include <QDesktopWidget>
#include <QLibrary>
#include <QApplication>
#include <QFrame>
#include <QLabel>
#include <QComboBox>
#include "QListView"
#include "QStringListModel"
#include "QLineEdit"
#include "QSpinBox"
#include <QSettings>

#include "commonfunction.h"

#include "halcon_opencv.h"

using namespace std;

#include "qt_graphics_view.h"


#include "qt_graphics_shape_circle_rectangle.h"

#include <QGraphicsScene>
#include <QGraphicsSceneWheelEvent>



class FunctionCreateShapeModel :public QDialog
{
public:
    QSettings* m_qsettings;
    
	QString m_dir       = "";
    QString m_section   = "";

    QtQGraphicsView* m_view ;
    QLabel*          m_view_pixel_qlabel;

    vector<GraphicsShapeRectangleCirce*> m_vector_graphics_shape_rectangle;

    vector<GraphicsShapeRectangleCirce*> m_vector_graphics_shape_circle;

	QPushButton* m_pushbutton_show_orign_image;
	QPushButton* m_pushbutton_load_image;
    QPushButton* m_pushbutton_detection;
    QPushButton* m_pushbutton_save_parameter;
    QPushButton* m_pushbutton_return;

    QLabel* m_qlabel_message;

    int m_result;


    bool m_bool_draw=false;

	Mat m_image, m_image_show;


	Mat m_image_current;
    Mat m_image_model;
    QImage m_qimage_mask;
    HTuple m_model_match;

    HObject m_xld_show;

public:
    explicit FunctionCreateShapeModel(QDialog *parent = nullptr, QString dir="",QString section="") ;
    ~FunctionCreateShapeModel() ;
     void detectionImage();
     bool detection( HObject image_in, QString& message);
     void draw( Mat image_in,Mat& image_out);
     void loadParameter();
     void saveParameter();
	 bool FunctionCreateShapeModel::showNew();
	 bool FunctionCreateShapeModel::showEdit();
};
#pragma execution_character_set("utf-8")
